import 'package:WeChat/config.dart';
/**
 * @Author: zhouge
 * @Description: 功能界面
 * @Date: Created in 14:06 2020-09-29
 * @Modified By: 
 **/


import 'package:flutter/material.dart';
import 'full_width_icon_button.dart' show FullWidthIconButton;
import '../model/my.dart' show Profile,me;

class _Header extends StatelessWidget{

  static const AVATAR_SIZE = 72.0;
  static const SEPARATOR_SIZE = 16.0;
  static const QR_CODE_PREVIEW_SIZE = 20.0;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return FlatButton(
      onPressed: (){},
      color: Colors.white,
      padding: const EdgeInsets.only(
          left: SEPARATOR_SIZE,right: SEPARATOR_SIZE,
          top:10,bottom: 10),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Image.asset(
            me.avatar,
            width: AVATAR_SIZE,
            height: AVATAR_SIZE,),
          Expanded(
            child: Column(
              children: <Widget>[
                Container(
                  padding: const EdgeInsets.only(left: SEPARATOR_SIZE, bottom: 5.0),
                  alignment:Alignment.centerLeft,
                  child: Text(me.name),
                ),
                Container(
                  padding: const EdgeInsets.only(left: SEPARATOR_SIZE, bottom: 5.0),
                  alignment:Alignment.centerLeft,
                  child: Text(me.account),
                )
              ],
            ),
          ),
          Image.asset(
            'assets/images/ic_qrcode_preview_tiny.png',
            width: 20.0,height: 20.0,
          ),
          SizedBox(width:10.0),
          Icon(
            Icons.arrow_forward_ios,
            color: Color(AppColors.BackgroundColor),
            size: Constants.DiscoverRowButtonSize,),
        ],
      ),
    );
  }
}

class FunctionsPage extends StatefulWidget {
  @override
  _FunctionsPageState createState() => _FunctionsPageState();
}

class _FunctionsPageState extends State<FunctionsPage> {
  static const SEPARATOR_SIZE = 10.0;

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Color(AppColors.BackgroundColor),
      child: SingleChildScrollView(
        child: Column(
          children: <Widget>[
            SizedBox(height: SEPARATOR_SIZE,),
            _Header(),
            SizedBox(height: SEPARATOR_SIZE,),
            FullWidthIconButton(
              iconPath: 'assets/images/ic_wallet.png',
              title: '支付',
              onPressed: (){print('点击的是钱包');},
            ),
            SizedBox(height: SEPARATOR_SIZE,),
            FullWidthIconButton(
              iconPath: 'assets/images/ic_collections.png',
              title: '收藏',
              onPressed: (){print('点击的是钱包');},
            ),
            FullWidthIconButton(
              iconPath: 'assets/images/ic_album.png',
              title: '相册',
              onPressed: (){print('点击的是钱包');},
            ),
            FullWidthIconButton(
              iconPath: 'assets/images/ic_cards_wallet.png',
              title: '卡包',
              onPressed: (){print('点击的是钱包');},
            ),
            FullWidthIconButton(
              iconPath: 'assets/images/ic_emotions.png',
              title: '表情',
              onPressed: (){print('点击的是钱包');},
            ),
            SizedBox(height: SEPARATOR_SIZE,),
            FullWidthIconButton(
              iconPath: 'assets/images/ic_settings.png',
              title: '设置',
              onPressed: (){print('点击的是钱包');},
            ),
          ],
        ),
      ),
    );
  }
}
